package com.epalmpay.service.yunstream.datatransfer.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


public class DataService {
  
	public void processOrderId(){
		 DbHelper dbUitil=DbHelper.getDBHelper();
			if(dbUitil.openDatabase()){
				 List<Map<String,String>> orders=dbUitil.findRechargeOrder();
				
				for(Map<String,String> map:orders){
					String relationOrderNum=map.get("order_msg_txt");
					Integer orderId =Integer.parseInt(map.get("order_id"));
					int index=relationOrderNum.indexOf("���䶯");
					relationOrderNum= relationOrderNum.substring(index+4);
					//��ѯ��ԭ��ֵ������
				    int relateOrderId=dbUitil.findRelateOrderId(relationOrderNum);
				   //�޸� ��������
				    dbUitil.updateRelateOrderId(orderId,relateOrderId);
				}
				
			}
			dbUitil.closeDataBase();
	 }

	public void finishOilCardOrder() {
		DbHelper dbUitil=DbHelper.getDBHelper();
		if(dbUitil.openDatabase()){
			ArrayList<Map<String ,String>>oilCardOrders=dbUitil.findAllOilCard();
			for(Map<String,String> oilOrder:oilCardOrders){
				dbUitil.updateOilCard(oilOrder);
				if("2".equals(oilOrder.get("payment_status"))){
					dbUitil.insertChargeOrder(oilOrder);
					dbUitil.updateYlOilcardReplenishOrder(oilOrder);
				}
				
			}
		}
		dbUitil.closeDataBase();
	}
}
